/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 皮肤
	/// module : structs
	/// </summary>
	public class SkinPOD : IPOD 
    {
        public readonly static Func<SkinPOD> FACTORY = () => new SkinPOD();
		public static Func<SkinPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 时装id
        /// </summary>
		public int cid;
		/// <summary>
        /// 过期时间，-1代表永久
        /// </summary>
		public int expireTime;
		/// <summary>
        /// 是否是新的
        /// </summary>
		public bool isNew;
		
		
		
		/*-- constructors --*/
		public SkinPOD() {}
		public SkinPOD(int cid, int expireTime, bool isNew) {
			this.cid = cid;
			this.expireTime = expireTime;
			this.isNew = isNew;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_int(cid);
            _out.Write_int(expireTime);
            _out.Write_boolean(isNew);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            cid = _in.Read_int();
            if(!_in.HasRemaining()) return;
            expireTime = _in.Read_int();
            if(!_in.HasRemaining()) return;
            isNew = _in.Read_boolean();
        }
		
		public SkinPOD Clone() {
            SkinPOD o = DynamicFactory();
            o.cid = cid;
            o.expireTime = expireTime;
            o.isNew = isNew;
            return o;
        }
        
        public void Clear() {
            cid = default;
            expireTime = default;
            isNew = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "SkinPOD [";
			str += "cid=";
			str += cid;
			str += ", expireTime=";
			str += expireTime;
			str += ", isNew=";
			str += isNew;
			str += "]";
			return str;
		}
		
	}
}